﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yuans.BinaryConfig;

namespace BinaryConfigToSource
{
    class Program
    {
        static void Main(string[] args)
        {
            if(args.Length == 2)
            {
                string configFilePath = args[0];
                string outputFilePath = args[1];

                ConfigManager configManager = new ConfigManager(new List<ConfigItem>());
                configManager.LoadConfigFromFile(configFilePath);
                configManager.GenCStyleSourceCode(outputFilePath);

                Console.WriteLine("Source generated.");
            }
            else if(args.Length == 3)
            {
                string configFilePath = args[0];
                string sourceTemplateFile = args[1];
                string outputFilePath = args[2];

                ConfigManager configManager = new ConfigManager(new List<ConfigItem>());
                configManager.LoadConfigFromFile(configFilePath);
                configManager.GenCStyleSourceCode(sourceTemplateFile,outputFilePath);

                Console.WriteLine("Source generated.");
            }
            else
            {
                Console.WriteLine("Invalid parameter.");
            }
        }
    }
}
